﻿<presentation:UserControlView x:Class="Chronos.Client.Win.Views.Options.ProfilingFilter.View"
                              xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                              xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                              xmlns:commanding="clr-namespace:Rhiannon.Windows.Presentation.Commands;assembly=Rhiannon.Windows"
                              xmlns:presentation="clr-namespace:Rhiannon.Windows.Presentation;assembly=Rhiannon.Windows"
                              x:Uid="Profiler_Options_ProfilingFilterView">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="*" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>

        <Grid Grid.Row="0">
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto" />
                <ColumnDefinition Width="*" />
                <ColumnDefinition Width="Auto" />
                <ColumnDefinition Width="Auto" />
            </Grid.ColumnDefinitions>
            <TextBlock Grid.Row="0" Grid.Column="0" Text="Profiling filter: " Foreground="#000" />
            <ComboBox Grid.Row="0" Grid.Column="1" ItemsSource="{Binding Filters}" SelectedItem="{Binding SelectedFilter}" DisplayMemberPath="Name" />

            <TextBlock Grid.Row="1" Grid.Column="0" Text="Filter type: " Foreground="#000" />
            <ComboBox Grid.Row="1" Grid.Column="1" ItemsSource="{Binding FilterTypes}" SelectedItem="{Binding SelectedFilter.Type}"/>

            <Button Grid.Row="0" Grid.Column="2" Content="Set as default"  commanding:Event.Command="{Binding SetAsDefaultFilterCommand}" commanding:Event.CommandParameter="{Binding SelectedFilter}"  />
            <Button Grid.Row="0" Grid.Column="3" Content="Save filter" commanding:Event.Command="{Binding SaveFilterCommand}" commanding:Event.CommandParameter="{Binding SelectedFilter}"  />

            <Button Grid.Row="1" Grid.Column="2" Content="Restore filter" commanding:Event.Command="{Binding RestoreFilterCommand}" commanding:Event.CommandParameter="{Binding SelectedFilter}" />
            <Button Grid.Row="1" Grid.Column="3" Content="Delete filter" commanding:Event.Command="{Binding DeleteFilterCommand}" commanding:Event.CommandParameter="{Binding SelectedFilter}" />
        </Grid>
        <ListView Grid.Row="1" ItemsSource="{Binding FilterItems}" SelectedItem="{Binding SelectedFilterItem}">
            <ListView.View>
                <GridView>
                    <GridViewColumn>
                        <GridViewColumn.HeaderTemplate>
                            <DataTemplate>
                                <CheckBox commanding:Event.Command="{Binding DataContext.SelectAllFilterItemsCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type presentation:UserControlView}}}"
                                          commanding:Event.CommandParameter="{Binding IsChecked, RelativeSource={RelativeSource Mode=Self}}"/>
                            </DataTemplate>
                        </GridViewColumn.HeaderTemplate>
                        <GridViewColumn.CellTemplate>
                            <DataTemplate>
                                <CheckBox IsChecked="{Binding IsChecked}"/>
                            </DataTemplate>
                        </GridViewColumn.CellTemplate>
                    </GridViewColumn>
                    <GridViewColumn Header="Item">
                        <GridViewColumn.CellTemplate>
                            <DataTemplate>
                                <TextBlock Text="{Binding Name}" />
                            </DataTemplate>
                        </GridViewColumn.CellTemplate>
                    </GridViewColumn>
                </GridView>
            </ListView.View>
        </ListView>
        <Grid Grid.Row="2">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto" />
                <ColumnDefinition Width="*" />
                <ColumnDefinition Width="Auto" />
                <ColumnDefinition Width="Auto" />
                <ColumnDefinition Width="Auto" />
            </Grid.ColumnDefinitions>
            <Button Grid.Column="0" Content="Remove checked items" commanding:Event.Command="{Binding DeleteSelectedFilterItemsCommand}" HorizontalAlignment="Left" />
            <Button Grid.Column="2" Content="Load items from GAC" commanding:Event.Command="{Binding LoadFilterItemsFromGacCommand}" HorizontalAlignment="Left" />
            <Button Grid.Column="3" Content="Load items from folder" commanding:Event.Command="{Binding LoadFilterItemsFromFolderCommand}" HorizontalAlignment="Left" />
            <Button Grid.Column="4" Content="Load specific items" commanding:Event.Command="{Binding LoadSpecificFilterItemsCommand}" HorizontalAlignment="Left" />
        </Grid>
        <Grid Grid.Row="3">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto" />
                <ColumnDefinition Width="*" />
                <ColumnDefinition Width="Auto" />
            </Grid.ColumnDefinitions>
            <TextBlock Grid.Column="0" Text="Add filter: "/>
            <TextBox Grid.Column="1" Text="{Binding FilterItemText, UpdateSourceTrigger=PropertyChanged}" />
            <Button Grid.Column="2" Content="Add" commanding:Event.Command="{Binding AddTextFilterItemCommand}" />
        </Grid>

        <Grid Grid.Row="4">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*" />
                <ColumnDefinition Width="Auto" />
                <ColumnDefinition Width="Auto" />
                <ColumnDefinition Width="Auto" />
                <ColumnDefinition Width="Auto" />
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
            </Grid.RowDefinitions>
        </Grid>
    </Grid>
</presentation:UserControlView>